﻿using System;
using Microsoft.EntityFrameworkCore.Migrations;

#nullable disable

namespace Acme.ConcreteMixDesign.Migrations
{
    /// <inheritdoc />
    public partial class AddedDataBase : Migration
    {
        /// <inheritdoc />
        protected override void Up(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropForeignKey(
                name: "FK_JobRecords_Player_PlayerId",
                table: "JobRecords");

            migrationBuilder.DropForeignKey(
                name: "FK_JobRecords_Topics_TopicId",
                table: "JobRecords");

            migrationBuilder.DropIndex(
                name: "IX_JobRecords_PlayerId",
                table: "JobRecords");

            migrationBuilder.DropIndex(
                name: "IX_JobRecords_TopicId",
                table: "JobRecords");

            migrationBuilder.CreateTable(
                name: "TopicInformations",
                columns: table => new
                {
                    Id = table.Column<Guid>(type: "char(36)", nullable: false, collation: "ascii_general_ci"),
                    InformationName = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InformationPath = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    InformationType = table.Column<int>(type: "int", nullable: false),
                    TopicId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    ExtraProperties = table.Column<string>(type: "longtext", nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    ConcurrencyStamp = table.Column<string>(type: "varchar(40)", maxLength: 40, nullable: false)
                        .Annotation("MySql:CharSet", "utf8mb4"),
                    CreationTime = table.Column<DateTime>(type: "datetime(6)", nullable: false),
                    CreatorId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci"),
                    LastModificationTime = table.Column<DateTime>(type: "datetime(6)", nullable: true),
                    LastModifierId = table.Column<Guid>(type: "char(36)", nullable: true, collation: "ascii_general_ci")
                },
                constraints: table =>
                {
                    table.PrimaryKey("PK_TopicInformations", x => x.Id);
                    table.ForeignKey(
                        name: "FK_TopicInformations_Topics_TopicId",
                        column: x => x.TopicId,
                        principalTable: "Topics",
                        principalColumn: "Id");
                })
                .Annotation("MySql:CharSet", "utf8mb4");

            migrationBuilder.CreateIndex(
                name: "IX_TopicInformations_TopicId",
                table: "TopicInformations",
                column: "TopicId");
        }

        /// <inheritdoc />
        protected override void Down(MigrationBuilder migrationBuilder)
        {
            migrationBuilder.DropTable(
                name: "TopicInformations");

            migrationBuilder.CreateIndex(
                name: "IX_JobRecords_PlayerId",
                table: "JobRecords",
                column: "PlayerId");

            migrationBuilder.CreateIndex(
                name: "IX_JobRecords_TopicId",
                table: "JobRecords",
                column: "TopicId");

            migrationBuilder.AddForeignKey(
                name: "FK_JobRecords_Player_PlayerId",
                table: "JobRecords",
                column: "PlayerId",
                principalTable: "Player",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);

            migrationBuilder.AddForeignKey(
                name: "FK_JobRecords_Topics_TopicId",
                table: "JobRecords",
                column: "TopicId",
                principalTable: "Topics",
                principalColumn: "Id",
                onDelete: ReferentialAction.Cascade);
        }
    }
}
